From: Matthew Daley Date: Tue, 3 Dec 2013 08:51:54 +0000 (+0100) Subject: nested vmx: fix I/O port bitmap indexing arithmetic X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5822^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=b80e4583501904297d2ff5b0f905e68f81f8f2c9;p=xen.git nested vmx: fix I/O port bitmap indexing arithmetic The I/O port bitmap holds 8 ports per element, and hence the port number used when indexing into it should be shifted right by 3 bits, not 4. Signed-off-by: Matthew Daley Reviewed-by: Yang Zhang Acked-by: Eddie Dong --- diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 248e97586a..7fa110e585 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -2225,7 +2225,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs, __vmread(EXIT_QUALIFICATION, &qual); port = qual >> 16; bitmap = nvmx->iobitmap[port >> 15]; - if ( bitmap[(port & 0x7fff) >> 4] & (1 << (port & 0x7)) ) + if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) ) nvcpu->nv_vmexit_pending = 1; if ( !nvcpu->nv_vmexit_pending ) gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);